package com.example.tms.service;

import com.example.tms.entity.Project;
import com.example.tms.mapper.ProjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProjectService {

    @Autowired
    private ProjectMapper projectMapper;

    // 获取所有项目列表
    public List<Project> selectAll() {
        return projectMapper.selectList(null);
    }
    // 根据 ID 查询项目
    public Project selectById(Integer id) {
        return projectMapper.selectById(id);
    }

    // 添加项目信息
    public int insert(Project project) {
        return projectMapper.insert(project);
    }

    // 更新项目信息
    public int update(Project project) {
        return projectMapper.updateById(project);
    }

    // 删除项目信息
    public int deleteById(Integer id) {
        return projectMapper.deleteById(id);
    }
}
